package com.cj;

import com.cj.merchant.RoleService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author cc
 * @date 2025-05-13 14:42
 **/

public class Demo02 {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext parent = new ClassPathXmlApplicationContext();
        ClassPathXmlApplicationContext consumerCtx = new ClassPathXmlApplicationContext("beans-consumer.xml");
        ClassPathXmlApplicationContext merchantCtx = new ClassPathXmlApplicationContext("beans-merchant.xml");


        consumerCtx.setParent(parent);
        merchantCtx.setParent(parent);

        parent.refresh();

        RoleService bean = parent.getBean(RoleService.class);
        System.out.println("bean = " + bean);

    }
}
